package dto;

import entity.SuccessKilled;
import enums.SeckillStateEnum;

/**
 * 封装秒杀执行后的结果
 * @author liuwj
 *
 */
public class SeckillExecution {
	/**
	 * 秒杀商品id
	 */
	private long seckillId;
	/**
	 * 秒杀执行结果状态
	 */
	private int state;
	/**
	 * 状态信息表示
	 */
	private String stateInfo;
	/**
	 * 秒杀成功后返回成功秒杀对象
	 */
	private SuccessKilled successKilled;
	
	//秒杀成功后：返回全部信息
	public SeckillExecution(long seckillId, SeckillStateEnum stateEnum, SuccessKilled successKilled) {
		super();
		this.seckillId = seckillId;
		this.state = stateEnum.getState();
		this.stateInfo = stateEnum.getStateInfo();
		this.successKilled = successKilled;
	}
	//秒杀失败后给出失败原因等信息
	public SeckillExecution(long seckillId, SeckillStateEnum stateEnum) {
		super();
		this.seckillId = seckillId;
		this.state = stateEnum.getState();
		this.stateInfo = stateEnum.getStateInfo();
	}

	public long getSeckillId() {
		return seckillId;
	}
	public void setSeckillId(long seckillId) {
		this.seckillId = seckillId;
	}
	public int getState() {
		return state;
	}
	public void setState(int state) {
		this.state = state;
	}
	public String getStateInfo() {
		return stateInfo;
	}
	public void setStateInfo(String stateInfo) {
		this.stateInfo = stateInfo;
	}
	public SuccessKilled getSuccessKilled() {
		return successKilled;
	}
	public void setSuccessKilled(SuccessKilled successKilled) {
		this.successKilled = successKilled;
	}
	@Override
	public String toString() {
		return "SeckillExecution [seckillId=" + seckillId + ", state=" + state + ", stateInfo=" + stateInfo
				+ ", successKilled=" + successKilled + "]";
	}
	
}
